package com.forekonw.demo8;

/**
 *静态变量:可以被多个对象共享
 * 作用:可以作为累加器来使用
 */
public class StaticVar {
    public static int i;
    public StaticVar(){
        i++;
        System.out.println(i);
    }

    public static void main(String[] args) {
        StaticVar staticVar0 = new StaticVar();
        StaticVar staticVar1 = new StaticVar();
        StaticVar staticVar2 = new StaticVar();
        StaticVar staticVar3 = new StaticVar();
        StaticVar staticVar4= new StaticVar();
    }

}
